<template>
	<view class="news-details">
		<text class="title">{{detail.title}}</text>
		<view class="info">
			<text>发布时间:{{detail.add_time | formaDate}}</text>
			<text>浏览次数:{{detail.click}}</text>
		</view>
		<view class="detail">
			<rich-text :nodes="detail.content"></rich-text>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				detail:{}
			}
		},
		methods: {
			async getNewsDetail() {
				const res = await this.$myRequest({
					url: '/api/getnew/'+this.id
				})
				this.detail=res.data.message[0]
			}
		},
		onLoad(options) {
			console.log(options)
			this.id=options.id
			this.getNewsDetail()
		}
	}
</script>

<style lang="scss">
.news-details{
	font-size: 28rpx;
	padding: 0 20rpx;
	.title{
		text-align: center;
		display: block;
		margin: 20rpx;
		font-size: 40rpx;
		font-weight: 600;
	}
	.info{
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}
}
</style>
